package books;

public class Book {
    // 图书的元素
    private String name;    // 书名
    private String author;  // 作者
    private int price;  // 价格
    private String type;    // 类型
    private boolean IsBorrowed; // 是否被借阅

    // 构造函数
    public Book(String name, String author, int price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
        //IsBorrowed = isBorrowed;
    }

    // getter && setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isBorrowed() {
        return IsBorrowed;
    }

    public void setBorrowed(boolean borrowed) {
        IsBorrowed = borrowed;
    }

    // 调用时将返回图书信息（字符串形式）
    public String toString(){
        return "Book{"
                +"name="+getName()+", "
                +"author="+getAuthor()+", "
                +"price="+getPrice()+", "
                +"type="+getType()+", "
                +"isborrowed="+isBorrowed()
                +"}";
    }
}
